﻿using H2.NET.Business;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace H2.NET.Web.Pages.SMD.Service
{
    public static class AssessmentService
    {
        public static t_Assessment GetBySubmitData(string process, int incident)
        {
            return (t_Assessment.process == process
                        & t_Assessment.incident == incident
                        & t_Assessment.step == "Submit Data").ListFirst<t_Assessment>(" id desc");
        }
        public static t_Assessment FindByPIS(string process, int incident, string step)
        {
            return (t_Assessment.process == process
                    & t_Assessment.incident == incident
                    & t_Assessment.step == step).ListFirst<t_Assessment>();
        }

        public static List<t_Assessment> FindByPI(string process, int incident)
        {
            return (t_Assessment.process == process
                & t_Assessment.incident == incident).List<t_Assessment>().ToList();
        }
        public static List<string> GetIdsByTaskApi(TaskAPI taskapi)
        {
            return (t_Assessment.process == taskapi.Process
               & t_Assessment.incident == taskapi.Incident).List<t_Assessment>().Select(t => t.ID).ToList();
        }
    }
}